home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4963 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  811 b 

  1. Path: news.cac.psu.edu!psuvm!f0o
  2. Organization: Penn State University
  3. Date: Thu, 1 Feb 1996 16:45:31 EST
  4. From: Tim Benner <F0O@psuvm.psu.edu>
  5. Message-ID: <96032.164531F0O@psuvm.psu.edu>
  6. Newsgroups: comp.lang.c++
  7. Subject: template problem in BC++ 3.0
  8.  
  9.    The linker is telling me it can't find the name of a template function
  10. I write when the template function is in another file.  If the template
  11. function and the line which calls the template function are in the same
  12. program, I have no problem.
  13.    Below is how the code looks:
  14.  
  15. ====File temp.h=====
  16. template <class T> newmax(T x, T y);
  17.  
  18. ====file temp.cpp====
  19. template <class T> newmax(T x, T y)
  20. {
  21. ...function body...
  22. }
  23.  
  24. ===main program===
  25. result = newmax(5, 3);
  26.  
  27.    This is roughly how things look.  The linker tells me it can't find
  28. a name for newmax.
  29.  
  30. [Tim]
  31.